package com.xinruke.hostels.support.service.impl;

import com.xinruke.hostels.support.mapper.SysDiquMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;


@Service
@Transactional
public class CommonService {
    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Resource
    private SysDiquMapper sysDiquMapper;

//    @Transactional
//    public Boolean certificate(CertificateVO co) throws Exception {
//        if (IDCARD.getBianma().equals(co.getIdentityType())) {
//            String regularExpression = "(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|" +
//                    "(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)";
//            String idNo = co.getIdentityNo();
//            if (idNo != null) {
//                if (!idNo.matches(regularExpression)) {
//                    throw new Exception(ERROR_21113.getBianma() + "");
//                }
//            }
//        }
//        if (isOrNotCertif()) {
//            throw new Exception(ERROR_21112.getBianma() + "");
//        }
//
//        //得到custid
//        Subject currentUser = SecurityUtils.getSubject();
//        Customer cus = (Customer) currentUser.getPrincipal();
//        int custId = cus.getId();
//
//        String date = DateUtils.getDateTime();
//        IdentityInfo certi = new IdentityInfo();
//        certi.setZid(UuidUtil.getUUID());
//        certi.setCustId(custId + "");
//        certi.setCustName(co.getCustName());
//        certi.setIdentityType(co.getIdentityType());
//        certi.setIdentityNo(co.getIdentityNo());
////        certi.setProvinceId(co.getProvinceId());
////        certi.setCityId(co.getCityId());
////        certi.setCreatedTime(date);
////        certi.setUpdatedTime(date);
////        certi.setAuditState("1");
////        certi.setAppId(co.getAppId());
//        //将身份认证信息插入数据库
//        identityInfoMapper.insertSelective(certi);
//
//        Customer customer = new Customer();
//        customer.setCertificateState(true);
//        customer.setUpdatedTime(DateUtils.getDateTime());
//        Weekend<Customer> weekend = Weekend.of(Customer.class);
//        WeekendCriteria<Customer, Object> Criteria = weekend.weekendCriteria();
//        Criteria.andEqualTo(Customer::getId, custId);
//        customerMapper.updateByExampleSelective(customer, weekend);
//
//        return true;
//    }



}
